/*
 * Copyright (c) 2005, 2014 vacoor
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 */
package org.vacoor.nothing.security.logging.log4j;

import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.spi.LoggingEvent;
import org.vacoor.nothing.security.logging.LogWatcher;

public final class EventAppender extends AppenderSkeleton {
    final LogWatcher<LoggingEvent> watcher;

    public EventAppender(LogWatcher<LoggingEvent> watcher) {
        this.watcher = watcher;
    }

    public void append(LoggingEvent event) {
        this.watcher.add(event, event.timeStamp);
    }

    public void close() {
        this.watcher.reset();
    }

    public boolean requiresLayout() {
        return false;
    }
}